import axios from '@/utils/request'
import { ApiResponse, ArticleDetail } from '../../types/data'
import { RootThunkAction } from '../../types/store'
export function getArticleInfo(id: string): RootThunkAction {
  return async (dispatch) => {
    const res = await axios.get<ApiResponse<ArticleDetail>>(`/articles/${id}`)
    // console.log(res.data.data)
    dispatch({
      type: 'article/setArticleInfo',
      payload: res.data.data,
    })
  }
}
